<?php

namespace Admin\Controller;



class FeedbookController extends AdminController {



	public function index(){

		$obj = M('Feedbook');

		$count = $obj->where($map)->count();

		import("Common.ORG.Page");

		$page = new \Page($count, 20);

		$show = $page->show();

		$list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();

		$this->assign('list', $list);

		$this->assign('page', $show);

		$this->display();

	}



	public function view(){

		$id = (int) $_GET['id'];

		if (!isset ($id)) {

			$this->error('Parameter error');

		}

		$obj = M('Feedbook');

		$list = $obj->where("id=$id")->find();



		if (!$list) {

			$this->error('Information does not exist');

		} else {

			$this->assign('list', $list);

			$this->display();

		}

	}





	public function del(){	

		$id=I('post.selectedids');



		if($id==''){

			$state = "You do not select any information!";

		}else{

			foreach ($id as $v) {

				$obj = M('Feedbook');

				$where['id'] = $v;

				$obj->where($where)->delete();

			}

			$state = 'SUCCESS';

	        $message = 'Successful operation';

	        $url = U('Feedbook/index');

		}

		echo $this->echo_json_str($state,$message,$url);

    }

}

?>